package group.sicher.common.entity;

import group.sicher.common.constant.senum.StatusEnum;

import javax.persistence.*;
import java.util.Objects;

/**
 * @Auth rock
 * @Date 2019/7/1 21:07
 * @description
 */
@Entity
@Table(name = "wm_food")
public class FoodEntity {

    private Long id;
    private Long shopId;
    private Long categoryId;
    private String name;
    private String desc;
    private String coverUrl;
    private String originPrice;
    private String sellPrice;
    private String discount;
    private Long like;
    private Long limitNum;
    private String option;
    private Long totalSales;
    private Long monthSales;
    private String praiseRate;
    private Integer status;//TODO 枚举
    private Long createAt;
    private Long updateAt;
    private String tags;
    private Long maxStock;
    private Long currentStock;
    private StatusEnum rest;
    private Long startAt;
    private Long endAt;

       @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "shop_id", nullable = false)
    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    @Basic
    @Column(name = "category_id", nullable = true)
    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    @Basic
    @Column(name = "name", nullable = true, length = 60)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "desc", nullable = true, length = 100)
    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Basic
    @Column(name = "cover_url", nullable = true, length = 500)
    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl = coverUrl;
    }

    @Basic
    @Column(name = "origin_price", nullable = true, length = 20)
    public String getOriginPrice() {
        return originPrice;
    }

    public void setOriginPrice(String originPrice) {
        this.originPrice = originPrice;
    }

    @Basic
    @Column(name = "sell_price", nullable = true, length = 20)
    public String getSellPrice() {
        return sellPrice;
    }

    public void setSellPrice(String sellPrice) {
        this.sellPrice = sellPrice;
    }

    @Basic
    @Column(name = "discount", nullable = true, length = 20)
    public String getDiscount() {
        return discount;
    }

    public void setDiscount(String discount) {
        this.discount = discount;
    }

    @Basic
    @Column(name = "like", nullable = true)
    public Long getLike() {
        return like;
    }

    public void setLike(Long like) {
        this.like = like;
    }

    @Basic
    @Column(name = "limit_num", nullable = true)
    public Long getLimitNum() {
        return limitNum;
    }

    public void setLimitNum(Long limitNum) {
        this.limitNum = limitNum;
    }

    @Basic
    @Column(name = "option", nullable = true, length = 500)
    public String getOption() {
        return option;
    }

    public void setOption(String option) {
        this.option = option;
    }

    @Basic
    @Column(name = "total_sales", nullable = true)
    public Long getTotalSales() {
        return totalSales;
    }

    public void setTotalSales(Long totalSales) {
        this.totalSales = totalSales;
    }

    @Basic
    @Column(name = "month_sales", nullable = true)
    public Long getMonthSales() {
        return monthSales;
    }

    public void setMonthSales(Long monthSales) {
        this.monthSales = monthSales;
    }

    @Basic
    @Column(name = "praise_rate", nullable = true, length = 20)
    public String getPraiseRate() {
        return praiseRate;
    }

    public void setPraiseRate(String praiseRate) {
        this.praiseRate = praiseRate;
    }

    @Basic
    @Column(name = "status", nullable = true)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "create_at", nullable = true)
    public Long getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Long createAt) {
        this.createAt = createAt;
    }

    @Basic
    @Column(name = "update_at", nullable = true)
    public Long getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Long updateAt) {
        this.updateAt = updateAt;
    }

    @Basic
    @Column(name = "tags", nullable = true, length = 60)
    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    @Basic
    @Column(name = "max_stock", nullable = true)
    public Long getMaxStock() {
        return maxStock;
    }

    public void setMaxStock(Long maxStock) {
        this.maxStock = maxStock;
    }

    @Basic
    @Column(name = "current_stock", nullable = true)
    public Long getCurrentStock() {
        return currentStock;
    }

    public void setCurrentStock(Long currentStock) {
        this.currentStock = currentStock;
    }

    @Basic
    @Column(name = "rest", nullable = true)
    public StatusEnum getRest() {
        return rest;
    }

    public void setRest(StatusEnum rest) {
        this.rest = rest;
    }

    @Basic
    @Column(name = "start_at", nullable = true)
    public Long getStartAt() {
        return startAt;
    }

    public void setStartAt(Long startAt) {
        this.startAt = startAt;
    }

    @Basic
    @Column(name = "end_at", nullable = true)
    public Long getEndAt() {
        return endAt;
    }

    public void setEndAt(Long endAt) {
        this.endAt = endAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FoodEntity that = (FoodEntity) o;
        return id == that.id &&
                shopId == that.shopId &&
                Objects.equals(categoryId, that.categoryId) &&
                Objects.equals(name, that.name) &&
                Objects.equals(desc, that.desc) &&
                Objects.equals(coverUrl, that.coverUrl) &&
                Objects.equals(originPrice, that.originPrice) &&
                Objects.equals(sellPrice, that.sellPrice) &&
                Objects.equals(discount, that.discount) &&
                Objects.equals(like, that.like) &&
                Objects.equals(limitNum, that.limitNum) &&
                Objects.equals(option, that.option) &&
                Objects.equals(totalSales, that.totalSales) &&
                Objects.equals(monthSales, that.monthSales) &&
                Objects.equals(praiseRate, that.praiseRate) &&
                Objects.equals(status, that.status) &&
                Objects.equals(createAt, that.createAt) &&
                Objects.equals(updateAt, that.updateAt) &&
                Objects.equals(tags, that.tags) &&
                Objects.equals(maxStock, that.maxStock) &&
                Objects.equals(currentStock, that.currentStock) &&
                Objects.equals(rest, that.rest) &&
                Objects.equals(startAt, that.startAt) &&
                Objects.equals(endAt, that.endAt);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, shopId, categoryId, name, desc, coverUrl, originPrice, sellPrice, discount, like, limitNum, option, totalSales, monthSales, praiseRate, status, createAt, updateAt, tags, maxStock, currentStock, rest, startAt, endAt);
    }
}
